<%@ page language="java" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'login.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    This is my JSP page. <br>
    <form action="<%=basePath%>/servlet/ManagerServlet" method="POST" >
    用户:<input type="text" name="user" id="user" /><br/>
   	密码:<input type="password" name="pass" id="pass" /><br/>
   	<input type="submit" value="登陆" onClick="return check();"/>
    </form>
    <%
    	request.setCharacterEncoding("UTF-8");
    	if(request.getParameter("msg")!=null){
    	%>
    	<span style="font-size:12px;">登陆出错，请重新登陆&nbsp;如果没有账户请<a href="./reg.jsp">注册</a></span>
    	<%} %>
  </body>
</html>
<script>
function check(){
	var user=document.getElementById("user").value;
	var pass=document.getElementById("pass").value;
	if(user!=""&&pass!=""){
		return true;
	}
	else{
		alert("请输入正确格式的用户名和密码");
		return false;
	}
}
</script>